package com.yunbiao.ybbusstopplate.serialport

import android.content.Intent
import android.util.Log
import com.blankj.utilcode.util.AppUtils
import com.blankj.utilcode.util.ServiceUtils
import com.yunbiao.ybbusstopplate.base.APP

class SerTool {
    companion object{
        private val TAG="SerTool"
        fun startPort(){
//            if (ServiceUtils.isServiceRunning(SerialPortService().javaClass)){
//                ServiceUtils.stopService(SerialPortService().javaClass)
//            }
//            ServiceUtils.startService(SerialPortService().javaClass)

//            Log.d(TAG,"---------startPort")
            if (ServiceUtils.isServiceRunning(SerialPortService2().javaClass)){
                ServiceUtils.stopService(SerialPortService2().javaClass)
            }
            ServiceUtils.startService(SerialPortService2().javaClass)
        }

        fun closePort(){
//            if (ServiceUtils.isServiceRunning(SerialPortService().javaClass)){
//                ServiceUtils.stopService(SerialPortService().javaClass)
//            }
//            Log.d(TAG,"---------closePort")
            if (ServiceUtils.isServiceRunning(SerialPortService2().javaClass)){
                ServiceUtils.stopService(SerialPortService2().javaClass)
            }
        }
    }
}